/* 现代化代码块头部样式 */

/* 代码块头部覆盖层 - 现代化设计 */
.code-header-overlay {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 12px 16px;
	background: linear-gradient(135deg,
		rgba(255, 255, 255, 0.95) 0%,
		rgba(248, 250, 252, 0.98) 100%);
	border-bottom: 1px solid rgba(226, 232, 240, 0.8);
	border-top-left-radius: 12px;
	border-top-right-radius: 12px;
	backdrop-filter: blur(12px);
	z-index: 10;
	transition: all 0.3s ease;

	&:hover {
		background: linear-gradient(135deg,
			rgba(255, 255, 255, 0.98) 0%,
			rgba(248, 250, 252, 1) 100%);
		border-bottom-color: rgba(226, 232, 240, 1);
	}
}

/* 语言标签 - 现代化设计 */
.code-lang-tag {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border: none;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	color: white;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;

	&::before {
		content: '';
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: rgba(255, 255, 255, 0.9);
		margin-right: 6px;
		box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
		animation: pulse 2s infinite;
	}

	&::after {
		content: '';
		position: absolute;
		top: 0;
		left: -100%;
		width: 100%;
		height: 100%;
		background: linear-gradient(90deg,
			transparent,
			rgba(255, 255, 255, 0.2),
			transparent);
		transition: left 0.5s;
	}

	&:hover::after {
		left: 100%;
	}
}

/* 脉冲动画 */
@keyframes pulse {
	0%, 100% {
		opacity: 0.8;
		transform: scale(1);
	}
	50% {
		opacity: 1;
		transform: scale(1.1);
	}
}

/* 现代化复制按钮 - 参考豆包设计 */
.copy-code-btn {
	display: flex;
	align-items: center;
	gap: 4px;
	background: #e5e7eb;
	border: none;
	border-radius: 6px;
	padding: 6px 10px;
	font-size: 12px;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: none;
	position: absolute;
	top: 12px;
	right: 12px;
	min-height: 28px;

	// 复制文本样式
	.copy-text {
		font-size: 12px;
		font-weight: 500;
		transition: all 0.2s ease;
	}

	&:hover {
		background: #d1d5db;
		transform: translateY(-1px);
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	}

	&:active {
		transform: translateY(0);
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
	}

	// 复制成功状态 - 绿色主题
	&.copied {
		background: #16a34a !important;
		color: white !important;
		transform: translateY(0);
		box-shadow: 0 2px 4px rgba(22, 163, 74, 0.25);

		svg {
			animation: checkmark 0.3s ease-in-out;
		}

		.copy-text {
			animation: textPulse 0.3s ease-in-out;
		}
	}

	svg {
		transition: transform 0.2s ease;
		stroke-width: 2;
		flex-shrink: 0;
		width: 14px;
		height: 14px;
	}
}

@keyframes checkmark {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes textPulse {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.1);
		opacity: 0.8;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

/* 代码块整体优化 - 白色背景设计 */
.code-block {
	position: relative;
	margin: 16px 0;
	border-radius: 8px;
	overflow: hidden;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

	pre {
		margin: 0;
		padding: 48px 16px 16px 16px; // 为头部留出空间
		background: #ffffff;
		overflow-x: auto;

		code {
			font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
			font-size: 14px;
			line-height: 1.6;
			color: #1f2937;
		}
	}
}